package com.hc.util;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.hc.util.snmp.APIServer;
import com.hc.util.snmp.SNMPConstens;

public class DateClearUtile {

	public static List<Map<String, Object>> map;

	public static boolean readDate() {

		try {

			map = APIServer.getSNMPService().getTable(SNMPConstens.EcDialWifiCommon.EcWifiSystem.EC_TEST_STEP_INFO_TABLE);

			if (map.size() > 0) {

				return true;

			}

		} catch (Exception e) {
			e.printStackTrace();
		}

		return false;

	}

	public static boolean clear() {

		try {

			while (true) {

				if (DateClearUtile.readDate()) {

					// //TODO ɾ���������
					Map<String, Object> deleteMap = new HashMap<String, Object>();

					for (Map<String, Object> subMap : map) {
						Object o = subMap.get("1.3.6.1.4.1.36174.11.2.1.4.1.1");
						if (o != null) {

							deleteMap
									.put((SNMPConstens.EcDialWifiCommon.EcWifiSystem.EcTestStepInfoTable.EcTestStepInfoTableEntry.ECTESTSTEPINFOSTATUS
											+ "." + o.toString()), 6);
						}

					}
					APIServer.getSNMPService().set(deleteMap);

				} else {

					return true;
				}

			}

		} catch (Exception e) {
			e.printStackTrace();
		}

		return true;

	}
}
